﻿namespace SERFLITEMAX20.DataObjects
{
    using System;
    using System.Collections;
    using System.Diagnostics;
    using System.IO;
    using System.Xml;
    using System.Xml.Serialization;

    [XmlRoot("EntryNameTable", Namespace="", IsNullable=false)]
    public class EntryNameTable
    {
        [XmlElement("EntryName", typeof(EntryName))]
        public ArrayList EntryNameArray = new ArrayList();

        public static EntryNameTable Load(string pFileName)
        {
            EntryNameTable table = new EntryNameTable();
            if (File.Exists(pFileName))
            {
                try
                {
                    XmlTextReader xmlReader = new XmlTextReader(pFileName);
                    XmlSerializer serializer = new XmlSerializer(table.GetType());
                    table = (EntryNameTable) serializer.Deserialize(xmlReader);
                    xmlReader.Close();
                }
                catch (Exception exception)
                {
                    Debug.WriteLine(exception.Message);
                    table = new EntryNameTable();
                }
            }
            return table;
        }
    }
}

